"""
des: QuickReName软件配置文件
author: mr_52hz
date: 2021-01-28
"""
import os

from PyQt5.QtCore import QSettings

from utils import get_sys_documents_dir

BASE_DIR = os.path.dirname(os.path.abspath(__file__))


DOCUMENTS_DIR = get_sys_documents_dir()
if DOCUMENTS_DIR is None:
    DOCUMENTS_DIR = BASE_DIR

APP_DIR = os.path.join(DOCUMENTS_DIR, 'QuickRename')
if not os.path.exists(APP_DIR):
    os.makedirs(APP_DIR)

VERSION = 'V1.0.0'
AUTHOR = 'mr_52hz'
QUICK_RENAME_NAME = 'QuickReName'

# 替换 前缀 后缀 修改格式
RENAME_FUNCS = {
    '换字符': 'replace',
    '删字符': 'delete',
    '改格式': 'changeFormat',
    '加前缀': 'addPrefix',
    '加后缀': 'addSuffix',
    'RE替换': 're',
    'zfill': 'reZeroFill'
}

MIN_WINDOW_WIDTH = 600
MIN_WINDOW_HEIGHT = 400

BTN_WIDTH = 80
BTN_HEIGHT = 30

PATH_LABEL_WIDTH = 400
PATH_LABEL_HEIGHT = 30

SRC_SIGN = ' ▼ '
DESC_SIGN = '➥ '


def to_height_w_h_screen(w, h):
    global MIN_WINDOW_WIDTH
    global MIN_WINDOW_HEIGHT
    global BTN_WIDTH
    global BTN_HEIGHT
    global PATH_LABEL_WIDTH
    global PATH_LABEL_HEIGHT
    if w > 1900 and h > 1000:
        MIN_WINDOW_WIDTH = 900
        MIN_WINDOW_HEIGHT = 600
        BTN_WIDTH = 90
        BTN_HEIGHT = 40
        PATH_LABEL_WIDTH = 400
        PATH_LABEL_HEIGHT = 40


q_st = QSettings(os.path.join(APP_DIR, 'config.ini'), QSettings.IniFormat)

if q_st.value('theme/font-size', False) is False:
    q_st.setValue('theme/font-size', 11)
